package fulbiNet.servlet;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import fulbiNet.modelo.Persona;
import fulbiNet.negocio.AdministrarPersonaNegocio;

/**
 * Servlet implementation class prueba
 */
@WebServlet("/prueba")
public class prueba extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public prueba() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		

		String Codigo=request.getParameter("Codigo");
		String Nombres=request.getParameter("Nombres");
		String Paterno=request.getParameter("Paterno");
		String Materno=request.getParameter("Materno");
		String Sexo=request.getParameter("Sexo");
		String TipoDoc=request.getParameter("TipoDoc");
		String NroDoc=request.getParameter("NroDoc");
		String Correo=request.getParameter("Correo");
		String Contrasena=request.getParameter("Contrasena");
		String FechaNac=request.getParameter("FechaNac");
		String Celular=request.getParameter("Celular");
		
		AdministrarPersonaNegocio neg = new AdministrarPersonaNegocio();	
		
		Persona vo = new Persona();
		vo.setCodigo(0);
		vo.setNombres(Nombres);
		vo.setPaterno(Paterno);
		vo.setMaterno(Materno);
		vo.setSexo(Sexo);
		vo.setTipodocumento(TipoDoc);
		vo.setNrodocumento(NroDoc);
		
		vo.setEmail(Correo);
		vo.setCelular(Celular) ;
				
		// Guardando datos en el scope SESSION
		HttpSession session = request.getSession();
		session.setAttribute("CLIENTES_VIP",vo);
		
		RequestDispatcher rd = request.getRequestDispatcher("RegistrarPersona.jsp");
		rd.forward(request, response);
	}

}
